home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 February: Tool Chest / Dev.CD Feb 94.toast / Tool Chest / Development Platforms / MPW Related / MPW Interfaces / PInterfaces / Menus.p < prev    next >
Encoding:
Text File  |  1993-09-17  |  6.3 KB  |  208 lines  |  [TEXT/MPS ]

  1. {
  2.     File:        Menus.p
  3.  
  4.     Copyright:    © 1983-1993 by Apple Computer, Inc.
  5.                 All rights reserved.
  6.  
  7.     Version:    System 7.1 for ETO #11
  8.     Created:    Tuesday, March 30, 1993 18:00
  9.  
  10. }
  11.  
  12. {$IFC UNDEFINED UsingIncludes}
  13. {$SETC UsingIncludes := 0}
  14. {$ENDC}
  15.  
  16. {$IFC NOT UsingIncludes}
  17.  UNIT Menus;
  18.  INTERFACE
  19. {$ENDC}
  20.  
  21. {$IFC UNDEFINED UsingMenus}
  22. {$SETC UsingMenus := 1}
  23.  
  24. {$I+}
  25. {$SETC MenusIncludes := UsingIncludes}
  26. {$SETC UsingIncludes := 1}
  27. {$IFC UNDEFINED UsingQuickdraw}
  28. {$I $$Shell(PInterfaces)Quickdraw.p}
  29. {$ENDC}
  30. {$SETC UsingIncludes := MenusIncludes}
  31.  
  32. CONST
  33. noMark = 0;                            {mark symbol for MarkItem}
  34.  
  35. { menu defProc messages }
  36. mDrawMsg = 0;
  37. mChooseMsg = 1;
  38. mSizeMsg = 2;
  39. mDrawItemMsg = 4;
  40. mCalcItemMsg = 5;
  41. textMenuProc = 0;
  42. hMenuCmd = 27;                        {itemCmd == 0x001B ==> hierarchical menu}
  43. hierMenu = -1;                        {a hierarchical menu - for InsertMenu call}
  44. mPopUpMsg = 3;                        {menu defProc messages - place yourself}
  45. mctAllItems = -98;                    {search for all Items for the given ID}
  46. mctLastIDIndic = -99;                {last color table entry has this in ID field}
  47.  
  48. TYPE
  49. MenuPtr = ^MenuInfo;
  50. MenuHandle = ^MenuPtr;
  51. MenuInfo = RECORD
  52.  menuID: INTEGER;
  53.  menuWidth: INTEGER;
  54.  menuHeight: INTEGER;
  55.  menuProc: Handle;
  56.  enableFlags: LONGINT;
  57.  menuData: Str255;
  58.  END;
  59.  
  60. MCEntryPtr = ^MCEntry;
  61. MCEntry = RECORD
  62.  mctID: INTEGER;                    {menu ID.  ID = 0 is the menu bar}
  63.  mctItem: INTEGER;                    {menu Item. Item = 0 is a title}
  64.  mctRGB1: RGBColor;                    {usage depends on ID and Item}
  65.  mctRGB2: RGBColor;                    {usage depends on ID and Item}
  66.  mctRGB3: RGBColor;                    {usage depends on ID and Item}
  67.  mctRGB4: RGBColor;                    {usage depends on ID and Item}
  68.  mctReserved: INTEGER;                {reserved for internal use}
  69.  END;
  70.  
  71.  
  72. MCTablePtr = ^MCTable;
  73. MCTableHandle = ^MCTablePtr;
  74.  
  75. MCTable = ARRAY [0..0] OF MCEntry;    { the entries themselves }
  76.  
  77. MenuCRsrcPtr = ^MenuCRsrc;
  78. MenuCRsrcHandle = ^MenuCRsrcPtr;
  79. MenuCRsrc = RECORD
  80.  numEntries: INTEGER;                {number of entries}
  81.  mcEntryRecs: MCTable;                {ARRAY [1..numEntries] of MCEntry}
  82.  END;
  83.  
  84.  
  85. PROCEDURE InitMenus;
  86.     INLINE $A930;
  87. FUNCTION NewMenu(menuID: INTEGER;menuTitle: Str255): MenuHandle;
  88.     INLINE $A931;
  89. FUNCTION GetMenu(resourceID: INTEGER): MenuHandle;
  90.     INLINE $A9BF;
  91. PROCEDURE DisposeMenu(theMenu: MenuHandle);
  92.     INLINE $A932;
  93. PROCEDURE AppendMenu(menu: MenuHandle;data: Str255);
  94.     INLINE $A933;
  95. PROCEDURE AddResMenu(theMenu: MenuHandle;theType: ResType);
  96.     INLINE $A94D;
  97. PROCEDURE AppendResMenu(theMenu: MenuHandle;theType: ResType);
  98.     INLINE $A94D;
  99. PROCEDURE InsertResMenu(theMenu: MenuHandle;theType: ResType;afterItem: INTEGER);
  100.     INLINE $A951;
  101. PROCEDURE InsertMenu(theMenu: MenuHandle;beforeID: INTEGER);
  102.     INLINE $A935;
  103. PROCEDURE DrawMenuBar;
  104.     INLINE $A937;
  105. PROCEDURE InvalMenuBar;
  106.     INLINE $A81D;
  107. PROCEDURE DeleteMenu(menuID: INTEGER);
  108.     INLINE $A936;
  109. PROCEDURE ClearMenuBar;
  110.     INLINE $A934;
  111. FUNCTION GetNewMBar(menuBarID: INTEGER): Handle;
  112.     INLINE $A9C0;
  113. FUNCTION GetMenuBar: Handle;
  114.     INLINE $A93B;
  115. FUNCTION GetMBarHeight: INTEGER;
  116.     INLINE $3EB8,$0BAA;
  117. PROCEDURE SetMenuBar(menuList: Handle);
  118.     INLINE $A93C;
  119. PROCEDURE InsMenuItem(theMenu: MenuHandle;itemString: Str255;afterItem: INTEGER);
  120.     INLINE $A826;
  121. PROCEDURE InsertMenuItem(theMenu: MenuHandle;itemString: Str255;afterItem: INTEGER);
  122.     INLINE $A826;
  123. PROCEDURE DelMenuItem(theMenu: MenuHandle;item: INTEGER);
  124.     INLINE $A952;
  125. PROCEDURE DeleteMenuItem(theMenu: MenuHandle;item: INTEGER);
  126.     INLINE $A952;
  127. FUNCTION MenuKey(ch: CHAR): LONGINT;
  128.     INLINE $A93E;
  129. PROCEDURE HiliteMenu(menuID: INTEGER);
  130.     INLINE $A938;
  131. PROCEDURE SetItem(theMenu: MenuHandle;item: INTEGER;itemString: Str255);
  132.     INLINE $A947;
  133. PROCEDURE SetMenuItemText(theMenu: MenuHandle;item: INTEGER;itemString: Str255);
  134.     INLINE $A947;
  135. PROCEDURE GetItem(theMenu: MenuHandle;item: INTEGER;VAR itemString: Str255);
  136.     INLINE $A946;
  137. PROCEDURE GetMenuItemText(theMenu: MenuHandle;item: INTEGER;VAR itemString: Str255);
  138.     INLINE $A946;
  139. PROCEDURE DisableItem(theMenu: MenuHandle;item: INTEGER);
  140.     INLINE $A93A;
  141. PROCEDURE EnableItem(theMenu: MenuHandle;item: INTEGER);
  142.     INLINE $A939;
  143. PROCEDURE CheckItem(theMenu: MenuHandle;item: INTEGER;checked: BOOLEAN);
  144.     INLINE $A945;
  145. PROCEDURE SetItemMark(theMenu: MenuHandle;item: INTEGER;markChar: CHAR);
  146.     INLINE $A944;
  147. PROCEDURE GetItemMark(theMenu: MenuHandle;item: INTEGER;VAR markChar: CHAR);
  148.     INLINE $A943;
  149. PROCEDURE SetItemIcon(theMenu: MenuHandle;item: INTEGER;iconIndex: Byte);
  150.     INLINE $A940;
  151. PROCEDURE GetItemIcon(theMenu: MenuHandle;item: INTEGER;VAR iconIndex: Byte);
  152.     INLINE $A93F;
  153. PROCEDURE SetItemStyle(theMenu: MenuHandle;item: INTEGER;chStyle: Style);
  154.     INLINE $A942;
  155. PROCEDURE GetItemStyle(theMenu: MenuHandle;item: INTEGER;VAR chStyle: Style);
  156. PROCEDURE CalcMenuSize(theMenu: MenuHandle);
  157.     INLINE $A948;
  158. FUNCTION CountMItems(theMenu: MenuHandle): INTEGER;
  159.     INLINE $A950;
  160. FUNCTION GetMHandle(menuID: INTEGER): MenuHandle;
  161.     INLINE $A949;
  162. FUNCTION GetMenuHandle(menuID: INTEGER): MenuHandle;
  163.     INLINE $A949;
  164. PROCEDURE FlashMenuBar(menuID: INTEGER);
  165.     INLINE $A94C;
  166. PROCEDURE SetMenuFlash(count: INTEGER);
  167.     INLINE $A94A;
  168. FUNCTION MenuSelect(startPt: Point): LONGINT;
  169.     INLINE $A93D;
  170. PROCEDURE InitProcMenu(resID: INTEGER);
  171.     INLINE $A808;
  172. PROCEDURE GetItemCmd(theMenu: MenuHandle;item: INTEGER;VAR cmdChar: CHAR);
  173.     INLINE $A84E;
  174. PROCEDURE SetItemCmd(theMenu: MenuHandle;item: INTEGER;cmdChar: CHAR);
  175.     INLINE $A84F;
  176. FUNCTION PopUpMenuSelect(menu: MenuHandle;top: INTEGER;left: INTEGER;popUpItem: INTEGER): LONGINT;
  177.     INLINE $A80B;
  178. FUNCTION MenuChoice: LONGINT;
  179.     INLINE $AA66;
  180. PROCEDURE DelMCEntries(menuID: INTEGER;menuItem: INTEGER);
  181.     INLINE $AA60;
  182. PROCEDURE DeleteMCEntries(menuID: INTEGER;menuItem: INTEGER);
  183.     INLINE $AA60;
  184. FUNCTION GetMCInfo: MCTableHandle;
  185.     INLINE $AA61;
  186. PROCEDURE SetMCInfo(menuCTbl: MCTableHandle);
  187.     INLINE $AA62;
  188. PROCEDURE DispMCInfo(menuCTbl: MCTableHandle);
  189.     INLINE $AA63;
  190. PROCEDURE DisposeMCInfo(menuCTbl: MCTableHandle);
  191.     INLINE $AA63;
  192. FUNCTION GetMCEntry(menuID: INTEGER;menuItem: INTEGER): MCEntryPtr;
  193.     INLINE $AA64;
  194. PROCEDURE SetMCEntries(numEntries: INTEGER; menuCEntries: MCTablePtr);
  195.     INLINE $AA65;
  196. PROCEDURE InsertFontResMenu(theMenu: MenuHandle; afterItem: INTEGER;scriptFilter: INTEGER);
  197.     INLINE $303C, $0400, $A825;
  198. PROCEDURE InsertIntlResMenu(theMenu: MenuHandle; theType: ResType;afterItem: INTEGER;
  199.     scriptFilter: INTEGER);
  200.     INLINE $303C, $0601, $A825;
  201.  
  202. {$ENDC} { UsingMenus }
  203.  
  204. {$IFC NOT UsingIncludes}
  205.  END.
  206. {$ENDC}
  207.  
  208.